Skip to content

Conversation

zhengAnBin
Copy link

I'm not sure if we can use this way, if we can, we can delete the parse.rs file,but using an unstable feature(fmt_internals), maybe we can wait until it is stable before merging the code

image

Copy link

@madsmtm madsmtm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You just have to bring the ToString trait into scope, then the method is already implemented - so no need for unstable functionality.

But the reason that Encoding's use a function to compare encodings instead of comparing strings is twofold:

  1. For performance, since it avoids an allocation (an possible re-allocations) inherent in creating the encoding string.
  2. Just because two encodings don't have the same encoding doesn't mean they shouldn't "compare equal" (which you would see if you had kept the tests in parse.rs, e.g. "Vv" == Encoding::Void should pass).
  • At least in the one place which this is really used, which is in objc, it is crucial that qualifiers are ignored, since otherwise the "verify_message" feature would basically be useless.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants